DEFINITION MODULE QuickDraw2;   (* Franz Kronseder 08.06.85 *)
                                (* last modified   08.06.85 fxk*)

FROM MacBase IMPORT Point,LongInt;
FROM QuickDraw IMPORT Rect,Pattern,RgnHandle,QDHandle;

EXPORT QUALIFIED
  PolyHandle,PolyPtr,Polygon,PicHandle,PicPtr,Picture,
  FrameRoundRect,PaintRoundRect,EraseRoundRect,InvertRoundRect,FillRoundRect,
  FrameOval,PaintOval,EraseOval,InvertOval,FillOval,FrameArc,PaintArc,EraseArc,
  InvertArc,FillArc,PtToAngle,SlopeFromAngle,AngleFromSlope,OpenPoly,ClosePoly,
  KillPoly,OffsetPoly,MapPoly,FramePoly,PaintPoly,ErasePoly,InvertPoly,FillPoly,
  NewRgn,DisposeRgn,CopyRgn,SetEmptyRgn,SetRectRgn,RectRgn,OpenRgn,CloseRgn,
  OffsetRgn,MapRgn,InsetRgn,SectRgn,UnionRgn,DiffRgn,XorRgn,EqualRgn,EmptyRgn,
  PtInRgn,RectInRgn,FrameRgn,PaintRgn,EraseRgn,InvertRgn,FillRgn,OpenPicture,
  ClosePicture,DrawPicture,PicComment,KillPicture,GetPicture;

TYPE Fixed = LongInt;
PolyHandle = POINTER TO PolyPtr;  PolyPtr = POINTER TO Polygon;
Polygon =  RECORD polySize:INTEGER;  polyBBox:Rect;
                  polyPoints: ARRAY[0..0] OF Point; END;
	     
PicHandle = POINTER TO PicPtr;  PicPtr    = POINTER TO Picture;
Picture   =  RECORD picSize:INTEGER;  picFrame:Rect; END;
               (* plus byte codes for picture content *)


(* RoundRect Routines *)
PROCEDURE FrameRoundRect  (VAR r: Rect; ovWd,ovHt: INTEGER);    (*INLINE $A8B0*)
PROCEDURE PaintRoundRect  (VAR r: Rect; ovWd,ovHt: INTEGER);    (*INLINE $A8B1*)
PROCEDURE EraseRoundRect  (VAR r: Rect; ovWd,ovHt: INTEGER);    (*INLINE $A8B2*)
PROCEDURE InvertRoundRect (VAR r: Rect; ovWd,ovHt: INTEGER);    (*INLINE $A8B3*)
PROCEDURE FillRoundRect   (VAR r: Rect; ovWd,ovHt: INTEGER;VAR pat: Pattern);
                                                                (*INLINE $A8B4*)
(* Oval Routines *)
PROCEDURE FrameOval  (VAR r: Rect);                             (*INLINE $A8B7*)
PROCEDURE PaintOval  (VAR r: Rect);                             (*INLINE $A8B8*)
PROCEDURE EraseOval  (VAR r: Rect);                             (*INLINE $A8B9*)
PROCEDURE InvertOval (VAR r: Rect);                             (*INLINE $A8BA*)
PROCEDURE FillOval   (VAR r: Rect; VAR pat: Pattern);           (*INLINE $A8BB*)

(* Arc Routines *)
PROCEDURE FrameArc  (VAR r: Rect; startAngle,arcAngle: INTEGER);(*INLINE $A8BE*)
PROCEDURE PaintArc  (VAR r: Rect; startAngle,arcAngle: INTEGER);(*INLINE $A8BF*)
PROCEDURE EraseArc  (VAR r: Rect; startAngle,arcAngle: INTEGER);(*INLINE $A8C0*)
PROCEDURE InvertArc (VAR r: Rect; startAngle,arcAngle: INTEGER);(*INLINE $A8C1*)
PROCEDURE FillArc   (VAR r: Rect; startAngle,arcAngle: INTEGER;VAR pat: Pattern);
                                                                (*INLINE $A8C2*)
PROCEDURE PtToAngle (VAR r: Rect; pt: Point; VAR angle: INTEGER);(*INLINE $A8C3*)
PROCEDURE SlopeFromAngle(angle: INTEGER): Fixed;                (*INLINE $A8BC*)
PROCEDURE AngleFromSlope(slope: Fixed): INTEGER;                (*INLINE $A8C4*)

(* Polygon Routines *)
PROCEDURE OpenPoly():    PolyHandle;                            (*INLINE $A8CB*)
PROCEDURE ClosePoly;                                            (*INLINE $A8CC*)
PROCEDURE KillPoly    (poly: PolyHandle);                       (*INLINE $A8CD*)
PROCEDURE OffsetPoly  (poly: PolyHandle; dh,dv: INTEGER);       (*INLINE $A8CE*)
PROCEDURE MapPoly     (poly: PolyHandle;VAR fromRect,toRect: Rect);(*INLINE $A8FC*)
PROCEDURE FramePoly   (poly: PolyHandle);                       (*INLINE $A8C6*)
PROCEDURE PaintPoly   (poly: PolyHandle);                       (*INLINE $A8C7*)
PROCEDURE ErasePoly   (poly: PolyHandle);                       (*INLINE $A8C8*)
PROCEDURE InvertPoly  (poly: PolyHandle);                       (*INLINE $A8C9*)
PROCEDURE FillPoly    (poly: PolyHandle;VAR pat: Pattern);      (*INLINE $A8CA*)


(* Region Calculations *)
PROCEDURE NewRgn():   RgnHandle;                                (*INLINE $A8D8*)
PROCEDURE DisposeRgn(rgn: RgnHandle);                           (*INLINE $A8D9*)
PROCEDURE CopyRgn   (srcRgn,dstRgn: RgnHandle);                 (*INLINE $A8DC*)
PROCEDURE SetEmptyRgn(rgn: RgnHandle);                          (*INLINE $A8DD*)
PROCEDURE SetRectRgn(rgn: RgnHandle; left,top,right,bottom: INTEGER); (*INLINE $A8DE*)
PROCEDURE RectRgn   (rgn: RgnHandle;VAR r: Rect);               (*INLINE $A8DF*)
PROCEDURE OpenRgn;                                              (*INLINE $A8DA*)
PROCEDURE CloseRgn  (dstRgn: RgnHandle);                        (*INLINE $A8DB*)
PROCEDURE OffsetRgn (rgn: RgnHandle; dh,dv: INTEGER);           (*INLINE $A8E0*)
PROCEDURE MapRgn    (rgn: RgnHandle;VAR fromRect,toRect: Rect); (*INLINE $A8FB*)
PROCEDURE InsetRgn  (rgn: RgnHandle; dh,dv: INTEGER);           (*INLINE $A8E1*)
PROCEDURE SectRgn   (srcRgnA,srcRgnB,dstRgn: RgnHandle);        (*INLINE $A8E4*)
PROCEDURE UnionRgn  (srcRgnA,srcRgnB,dstRgn: RgnHandle);        (*INLINE $A8E5*)
PROCEDURE DiffRgn   (srcRgnA,srcRgnB,dstRgn: RgnHandle);        (*INLINE $A8E6*)
PROCEDURE XorRgn    (srcRgnA,srcRgnB,dstRgn: RgnHandle);        (*INLINE $A8E7*)
PROCEDURE EqualRgn  (rgnA,rgnB: RgnHandle): BOOLEAN;            (*INLINE $A8E3*)
PROCEDURE EmptyRgn  (rgn: RgnHandle): BOOLEAN;                  (*INLINE $A8E2*)
PROCEDURE PtInRgn   (pt: Point; rgn: RgnHandle): BOOLEAN;       (*INLINE $A8E8*)
PROCEDURE RectInRgn (VAR r: Rect; rgn: RgnHandle): BOOLEAN;     (*INLINE $A8E9*)

(* Graphical Operations on Regions *)
PROCEDURE FrameRgn  (rgn: RgnHandle);                           (*INLINE $A8D2*)
PROCEDURE PaintRgn  (rgn: RgnHandle);                           (*INLINE $A8D3*)
PROCEDURE EraseRgn  (rgn: RgnHandle);                           (*INLINE $A8D4*)
PROCEDURE InvertRgn (rgn: RgnHandle);                           (*INLINE $A8D5*)
PROCEDURE FillRgn   (rgn: RgnHandle;VAR pat: Pattern);          (*INLINE $A8D6*)

(* Picture Routines *)
PROCEDURE OpenPicture(VAR picFrame: Rect): PicHandle;           (*INLINE $A8F3*)
PROCEDURE ClosePicture;                                         (*INLINE $A8F4*)
PROCEDURE DrawPicture(myPicture: PicHandle;VAR dstRect: Rect);  (*INLINE $A8F6*)
PROCEDURE PicComment(kind,dataSize: INTEGER; dataHandle: QDHandle);(*INLINE $A8F2*)
PROCEDURE KillPicture(myPicture: PicHandle);                    (*INLINE $A8F5*)
PROCEDURE GetPicture(picID: INTEGER):  PicHandle;               (*INLINE $A9BC*)

END QuickDraw2.
